ci(bq): env-driven test constants + GCP project setup runbook - #9
Closed
ihistand wants to merge 1 commit into
Closed
ci(bq): env-driven test constants + GCP project setup runbook#9ihistand wants to merge 1 commit into
ihistand wants to merge 1 commit into
Conversation
Makes the BigQuery integration test constants in cli/index_test_base.ts
read from environment variables so that the test project ID isn't
committed to source. Adds a setup runbook at
docs/gcp_test_project_setup.md.
Constants now read from:
SQLANVIL_TEST_BQ_PROJECT — defaults to "your-bigquery-project"
(compile-only sentinel; tests fail
loudly when used)
SQLANVIL_TEST_BQ_LOCATION — defaults to "US"
SQLANVIL_TEST_BQ_RESERVATION — defaults to "" (on-demand pricing,
no reservation needed)
This unblocks the two BQ tests that currently fail with
"Missing credentials JSON file":
//cli:index_run_e2e_test
//tests/integration:bigquery.spec
Contributors who want to run these locally now follow the runbook to
spin up a dedicated GCP test project (~30 min one-time setup; $0/mo
expected on BigQuery free tier).
Runbook contents:
- Why a dedicated project (blast radius, billing isolation, IAM)
- Free-tier cost expectations
- gcloud-only setup walkthrough (no console steps)
- Least-privilege IAM (no roles/owner — bigquery.dataEditor +
bigquery.jobUser only)
- .gitignore hardening for test_credentials/*.json
- GitHub Actions CI integration with the SQLANVIL_TEST_BQ_KEY secret
- Fork-PR safety guidance (don't expose secrets to fork PRs)
- Billing budget alerts, daily quota caps, key rotation
- Troubleshooting common failures
- Tear-down (gcloud projects delete with 30-day grace)
The third failing test (//tests/api:projects.spec) is NOT fixed by
this — it's an unrelated pre-existing schema-mismatch bug on the
`warehouse` property in workflow_settings validation.
Verified:
./scripts/docker-bazel build //cli/... → 23 targets, success
Collaborator
Author
|
Superseded: the Postgres reintegration + Dataform→SQLAnvil rename landed on |
ihistand
added a commit
that referenced
this pull request
Jul 21, 2026
…a post_operations) Mirrors the agent-skills SKILL.md update: delta #10 expanded with the AI/BI framing (descriptions/columns persist as catalog comments, join targets named in column descriptions, PK/FK via post_operations with NOT ENFORCED on BigQuery targets, uniqueKey/uniqueKeys exclusivity, catalog artifacts, guide link); delta #9 covers FKs; delta #11 NOT-ENFORCED flag scoped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W86VUf4ptKnmhxWoqgA7gb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the BigQuery integration test constants in `cli/index_test_base.ts` read from environment variables so that the test project ID isn't committed to source. Adds a setup runbook at `docs/gcp_test_project_setup.md` describing how to spin up a dedicated GCP test project.
Why
Currently 2 of the 3 failing tests on `main` are blocked by missing BigQuery credentials:
Once a contributor follows the runbook to provision a GCP project and exports the env vars, those two BQ tests pass.
Constants
`cli/index_test_base.ts` now reads from env vars with safe sentinels:
Runbook contents (`docs/gcp_test_project_setup.md`)
.gitignore
Added `test_credentials/*.json` to keep service-account keys out of commits even if a contributor names theirs something other than `bigquery.json`.
Verification
```bash
./scripts/docker-bazel build //cli/... # → 23 targets, success
```
Test fix not verifiable in this PR — requires a real GCP project. The runbook walks Ivan through provisioning one, after which:
```bash
export SQLANVIL_TEST_BQ_PROJECT="sqlanvil-test-XXX"
./scripts/docker-bazel test //tests/integration:bigquery.spec
```
should pass.
Stack
Stacked on PR #7 (`adapter/postgres-skeleton`). Merge order: #1 → #2 → #3 → #4 → #5 → #6 → #7 → this.
Out of scope
Test plan
🤖 Generated with Claude Code